%::PROVIDES=(
	name	=> ["APP_STATUSLIST"],
	desc	=> ["List all applications status summary."],
	type	=> "request",
	code	=> \&::do_handle_appstatuslist
);

#########################################################################
# This request will turn a list in the following format:		#
# OK appname:status:stime[,...]						#
#########################################################################

sub ::do_handle_appstatuslist {
my $str="";
my $app;
my $state;

	foreach $app (sort(keys(%{$appmap}))) {
		$state=$appmap->{$app}->{STATE};
		if($state eq "STARTED" || $state eq "STARTING") {
			if($str eq "") {
				$str.="$app:$state:".$appmap->{$app}->{STARTTIME}.":".$appmap->{$app}->{NODE};
			} else {
				$str.=",$app:$state:".$appmap->{$app}->{STARTTIME}.":".$appmap->{$app}->{NODE};
			}
		} else {
			if($str eq "") {
				$str.="$app:$state:NA:";
			} else {
				$str.=",$app:$state:NA:";
			}
		}
	}
	return "OK $str";
}

1;

